cmake_minimum_required (VERSION 2.6)

project (BRISK_Localizer)

# modify this according to your PC
set( EIGEN_INCLUDE_DIR "D:/eigen" )
find_package (glog 0.3.4 REQUIRED)

include_directories (
	${CMAKE_SOURCE_DIR}
	${EIGEN_INCLUDE_DIR}
)

# add our macro directory to cmake search path
if (EXISTS "${CMAKE_SOURCE_DIR}/cmake")
  set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
endif ()

include("${CMAKE_MODULE_PATH}/OptimizeCompilerFlags.cmake")
OptimizeCompilerFlags()

set(OpenCV_DIR "D:/opencv/vsbuild/install")
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})

if(OpenCV_FOUND)
	message(STATUS "find OpenCV")
	message(STATUS ${OpenCV_INCLUDE_DIRS})
	message("---------------------------")
else()
	message(STATUS "not find OpenCV")
endif()

find_package(OpenMP)
if (OPENMP_FOUND)
    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()

# find sqlite library
find_path(SQLITE3_INCLUDE_DIR sqlite3.h)
find_library(SQLITE3_LIBRARY qslite3)
if (SQLITE3_INCLUDE_DIR AND SQLITE3_LIBRARY)
	message(STATUS "find sqlite3")
	message(STATUS ${SQLITE3_INCLUDE_DIR})
	message(STATUS ${SQLITE3_LIBRARY})
	include_directories(${SQLITE3_INCLUDE_DIR})
	set(EXTRA_LIBS ${EXTRA_LIBS} ${SQLITE3_LIBRARY})
else()
	message(STATUS "not find sqlite3")
endif()


add_subdirectory(exif_reader)
add_subdirectory(pnp)

set(EXTRA_LIBS ${EXTRA_LIBS} ${OpenCV_LIBS} glog::glog exif_reader pnp)

aux_source_directory(${CMAKE_SOURCE_DIR} ROOT_SRC)
aux_source_directory(preprocess PREPROCESS_SRC)
add_executable(localizer ${ROOT_SRC} ${PREPROCESS_SRC})
target_link_libraries(localizer ${EXTRA_LIBS})